import ajax from './ajax'
var root = process.env.API_HOST
export default class API {

  // 获取商品分类页
  static reqCategory (parentId) {
    return ajax(root + '/webGoods/selectCategory',{parentId})
  }
  // 获取商品列表（综合 销量 新品 价格排序）
  static reqGoodsList ({moduleId,property,choose,num,size}) {
    return ajax(root + '/webGoods/goodsList',{moduleId,property,choose,num,size})
  }
  // 获取商品详情
  static reqGoodsDetail ({goodsId,userId}) {
    return ajax(root + '/webGoods/goodsDetails',{goodsId,userId})
  }
  static reqGoodsDetail1 ({goodsId}) {
    return ajax(root + '/webGoods/goodsDetails',{goodsId})
  }
  // 用户登录
  static reqLogin ({phone,password}) {
    return ajax(root + '/webLogin/userLogin',{phone,password})
  }


  // 发送手机验证码
  static reqSendCode (phone) {
    return ajax(root + '/webLogin/sendSMS',{phone})
  }
  // 登录页跳转手机注册
  static reqSignUp ({phone,password,sms,invitationCode}) {
    return ajax(root + '/webLogin/phoneRegister',{phone,password,sms,invitationCode})
  }
  // 登录页跳转修改密码
  static reqModiPwd ({phone,password,sms}) {
    return ajax(root + '/webLogin/updatePwd',{phone,password,sms})
  }


  // 获取邀请码
  static reqInvitation ({userId,token}) {
    return ajax(root + '/distribution/getInvitation',{userId,token})
  }
  // 获取合伙人中心信息
  static reqPartner ({userId,token}) {
    return ajax(root + '/distribution/partnerCount',{userId,token})
  }
  // 我的下级
  static reqPartnerL ({userId,token,num,size}) {
    return ajax(root + '/distribution/myPartner',{userId,token,num,size})
  }
  // 查看分销订单
  static reqPartnerOrder ({userId,token,userinfoId,time,num,size}) {
    return ajax(root + '/distribution/partnerOrder',{userId,token,userinfoId,time,num,size})
  }
  // 查看分销订单详情
  static reqfxOrderDetail ({userId,token,incomeId}) {
    return ajax(root + '/distribution/partnerIncome',{userId,token,incomeId})
  }
  // 查看订单列表
  static reqOrderList (params) {
    return ajax(root + '/order/selectOrder', params)
  }
  // 查看订单详情
  static reqOrderDetail ({userId,token,orderInfoId}) {
    return ajax(root + '/order/orderDetail',{userId,token,orderInfoId})
  }
  // 查看可领取优惠券
  // static reqCanGetCouponList ({userId,token}) {
  //   return ajax(root + '/user/couponsList',{userId,token})
  // }
  static reqCanGetCouponList () {
    return ajax(root + '/user/couponsList')
  }
  // 用户领取优惠券
  static reqGetCoupon ({userId,token,couponId}) {
    return ajax(root + '/user/getCoupon',{userId,token,couponId})
  }
  // 查看已领取优惠券
  static reqhasCoupon ({userId,token,code}) {
    return ajax(root + '/user/couponUserList',{userId,token,code})
  }
  // 查看收藏的产品
  static reqCollectList ({userId,token,num,size}) {
    return ajax(root + '/user/selectCollection',{userId,token,num,size})
  }
  // 收藏(取消收藏code:2 收藏code:1)
  static reqCancelCollect ({userId,token,goodsId,code}) {
    return ajax(root + '/user/collection',{userId,token,goodsId,code})
  }

  // 获取收货地址列表
  static reqAddressList ({userId,token,num,size}) {
    return ajax(root + '/user/selectShipAddress',{userId,token,num,size})
  }
  // 添加/修改 收货地址 code：1添加   code：2修改
  static reqaddAddress ({userId,token,consignee,mobile,area,address,code,city,county,areaCode,id,ifDefault}) {
    return ajax(root + '/user/shipAddress',({userId,token,consignee,mobile,area,address,code,city,county,areaCode,id,ifDefault}))
  }
  // 删除收货地址
  static reqdelAddress ({userId,token,addressId}) {
    return ajax(root + '/user/delAddress',{userId,token,addressId})
  }


  // 修改头像
  static reqModiAvatar (params) {
    return ajax(root + '/user/updPic', params, 'POST')
  }
  // 修改昵称
  static reqModiNicname ({userId,token,nickName}) {
    return ajax(root + '/user/updNickname',{userId,token,nickName})
  }
  // 退出登录
  static reqLogout ({userId,token}) {
    return ajax(root + '/user/logout',{userId,token})
  }


  // 意见反馈
  static reqAdvice ({userId,token,remark,remarkType}) {
    return ajax(root + '/user/remark',{userId,token,remark,remarkType})
  }
  // 我的消息
  static reqMessage ({userId,token,num,size}) {
    return ajax(root + '/user/getMessage',{userId,token,num,size})
  }
  // 标记消息已读
  static reqSignMessage ({userId,token,messageId}) {
    return ajax(root + '/user/signMessage',{userId,token,messageId})
  }

  // 取消订单
  static reqCancelOrder ({userId,token,orderInfoId}) {
    return ajax(root + '/order/cancellationOrder',{userId,token,orderInfoId})
  }
  // 获取商品评价
  static reqGoodsEval ({goodsId,num,size}) {
    return ajax(root + '/webGoods/remarkList',{goodsId,num,size})
  }
  // 确认收货
  static reqComfirmReceive ({userId,token,orderInfoId}) {
    return ajax(root + '/order/confirmReceipt',{userId,token,orderInfoId})
  }

  // 换绑旧手机
  static reqChangeOld ({userId,token}) {
    return ajax(root + '/user/oldSendSMS',{userId,token})
  }
  // 换绑新手机手机
  static reqChangeNew ({userId,token,phone}) {
    return ajax(root + '/user/newSendSMS',{userId,token,phone})
  }
  // 换绑结果
  static reqChangePhone ({userId,token,phone,newSMS,oldSMS}) {
    return ajax(root + '/user/changePhone',{userId,token,phone,newSMS,oldSMS})
  }

  // 查看购物车
  static reqSelectTbCart (params) {
    return ajax(root + '/tbCart/selectTbCart', params)
  }
  // 添加购物车
  static reqAddTbCart (params) {
    return ajax(root + '/tbCart/addTbCart', params)
  }
  // 删除购物车
  static reqRemoveTbCart (params) {
    return ajax(root + '/tbCart/removeTbCart', params)
  }
  // 修改商品数量
  static reqUpdateTbcartNum (params) {
    return ajax(root + '/tbCart/updateTbcartNum', params)
  }
  // 结算购物车
  static reqSettlement (params) {
    return ajax(root + '/tbCart/settlement', params)
  }
  // 提交订单
  static reqPlaceOrder (params) {
    return ajax(root + '/order/placeOrder', params)
  }
  // 评价
  static reqEvaluate (params) {
    return ajax(root + '/order/evaluate', params, 'POST')
  }
  // 支付宝付款
  static reqAliPay (params) {
    return ajax(root + '/ali/aliPay', params)
  }
  // 微信付款
  static reqWxPay (params) {
    return ajax(root + '/wx/wxPay', params)
  }
  // 申请退款
  static reqApplyRefund (params) {
    return ajax(root + '/order/applyRefund', params)
  }
  // 查看退款列表
  static reqSelectReturnOrderList (params) {
    return ajax(root + '/order/selectReturnOrderList', params)
  }


  // 个人中心页修改密码
  static reqModiProPwd ({userId,token,password,sms}) {
    return ajax(root + '/user/updatePwd',{userId,token,password,sms})
  }

  // 取消退款
  static reqCancelRefund ({orderInfoId,token,userId}) {
    return ajax(root + '/order/cancellationRefund',{orderInfoId,token,userId})
  }
  // 首页轮播图
  static reqBannerImg () {
    return ajax(root + '/shufflingImg/shufflingImgList')
  }
  // 微信授权绑定用户
  static reqWXRegister ({phone,sms,openId,access_token,invitationCode}) {
    return ajax(root + '/webLogin/wxRegister',{phone,sms,openId,access_token,invitationCode})
  }
  // 获取用户头像和昵称
  static reqAvatar ({userId,token}) {
    return ajax(root + '/user/getUserInfo', {userId,token})
  }

  // 
  // static reqWx () {
  //   return ajax(root + '/wx/wxNotifyUrl')
  // }
}
